package com.zkthink.ceres.member.service.impl;


import com.zkthink.base.R;
import com.zkthink.base.service.SuperServiceImpl;
import com.zkthink.ceres.member.dao.SignInHisMapper;
import com.zkthink.ceres.member.dao.SignInMapper;
import com.zkthink.ceres.member.entity.SignIn;
import com.zkthink.ceres.member.entity.SignInHis;
import com.zkthink.ceres.member.service.SignInHisService;
import com.zkthink.ceres.member.vo.SignInHisVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
@AllArgsConstructor
public class SignInHisServiceImpl extends SuperServiceImpl<SignInHisMapper, SignInHis> implements SignInHisService {

    @Autowired
    private SignInHisMapper signInHisMapper;

    @Autowired
    private SignInMapper signInMapper;

    @Override
    public R<SignInHisVO> seachByFristAndEndDay(LocalDateTime firstDay, LocalDateTime lastDay, Long mid) {
        SignInHisVO signInHisVO = new SignInHisVO();
        SignIn singnByMid = signInMapper.getSingnByMid(mid);

        List<SignInHis> signInHis = signInHisMapper.seachByFristAndEndDay(firstDay, lastDay, mid);
        signInHisVO.setSignInHisList(signInHis);
        signInHisVO.setSignIn(singnByMid);
        return R.success(signInHisVO);
    }
}
